<?php

namespace app\index\model;

use think\Model;
use think\model\concern\SoftDelete;

class Notice extends Model
{
    use SoftDelete;
    protected $name = 'car_notice'; //表名      默认类型
    protected $autoWriteTimestamp = true;
    protected $dateFormat = 'Y/m/d H:i:s';
    // 定义时间戳字段名
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';
    protected $deleteTime='delete_at';

    public function user()
    {
        return $this->hasOne(UserModel::class, 'id', 'otherUserid')->bind([
            'nickname',
            'avatar'
        ]);
    }

    public function info()
    {
        return $this->hasOne(CommentReplyModel::class, 'id', 'association')->with('info')->bind([
            'comment_id' => 'commentId',
            'photo_id',
            'photo_name',
            'cover'
        ]);
    }
}